package ch09.ex2_1_1_GenericsAtRuntimeTypeChecksAndCasts

/**
 * Created by caozp-ytcyc2007 on 2017/6/3.
 */

fun printSum(c: Collection<*>) {
    val intList = c as? List<Int> ?: throw IllegalArgumentException("List is expected")
    println(intList.sum())
}

fun main(args: Array<String>) {
    printSum(listOf(1, 2, 3))
}